{{include 'share/header'}}
<header>
  <div class="container">
    <h1>学生查询及管理</h1>
  </div>
</header>
<div class="container toolbar">
  <button class="btn btn-success" onclick="location.href='/add'">添加学生</button>
  <button class="btn btn-warning" data-toggle="modal" data-target="#searchModal">
    <span class="glyphicon glyphicon-search"></span> 搜索
  </button>
</div>
<div class="container data">
  <div class="table-responsive">
    <table class="table table-bordered table-hover">
      <tbody>
        <tr>
          <th>姓名</th>
          <th class="text-center">性别</th>
          <th class="text-center">年龄</th>
          <th class="text-center">手机号</th>
          <th>电子邮箱</th>
          <th class="text-center">修改</th>
          <th class="text-center">删除</th>
        </tr>
        {{each students as student}}
        <tr>
          <td>{{student.name}}</td>
          <td class="text-center">{{student.isMale | formatSex}}</td>
          <td class="text-center">{{student.age}}</td>
          <td class="text-center">{{student.phone}}</td>
          <td>{{student.email}}</td>
          <td class="text-center">
            <span class="glyphicon glyphicon-edit" onclick="location.href='/edit/{{student.id}}'"></span>
          </td>
          <td class="text-center">
            <span class="glyphicon glyphicon-trash" onclick="removeStudent('{{student.id}}', '{{student.name}}')"></span>
          </td>
        </tr>
        {{/each}}
      </tbody>
    </table>
  </div>
  <nav>
    <ul class="pagination">
      <li class="disabled">
        <a onclick="showPage(0, 1)">上一页</a>
      </li>
      <li class="active">
        <a onclick="showPage(1, 1)">1</a>
      </li>
      <li class="disabled">
        <a onclick="showPage(2, 1)">下一页</a>
      </li>
    </ul>
  </nav>
</div>
<!-- 删除确认模态框 -->
<div class="modal fade" id="removeModal" tabindex="-1" role="dialog">
  <div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h4 class="modal-title">确认要删除吗？</h4>
      </div>
      <div class="modal-body"></div>
      <div class="modal-footer">
        <button type="button" class="btn btn-danger" data-dismiss="modal">　确定　</button>
        <button type="button" class="btn btn-default" data-dismiss="modal">　取消　</button>
      </div>
    </div>
  </div>
</div>
<!-- 搜索模态框 -->
<div class="modal fade" id="searchModal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span>×</span></button>
        <h4 class="modal-title">学生信息搜索</h4>
      </div>
      <div class="modal-body">
        <form class="form-horizontal" id="searchForm">
          <div class="form-group">
            <label for="name" class="col-sm-3 control-label">姓名：</label>
            <div class="col-sm-4">
              <input id="name" name="name" class="form-control" placeholder="学生姓名" type="text">
            </div>
          </div>
          <div class="form-group">
            <label for="none" class="col-sm-3 control-label">性别：</label>
            <div class="col-sm-4">
              <label class="radio-inline">
                <input name="isMale" id="none" value="" checked="" type="radio"> 不限
              </label>
              <label class="radio-inline">
                <input name="isMale" id="male" value="true" type="radio"> 男
              </label>
              <label class="radio-inline">
                <input name="isMale" id="female" value="false" type="radio"> 女
              </label>
            </div>
          </div>
          <div class="form-group">
            <label for="phone" class="col-sm-3 control-label">手机：</label>
            <div class="col-sm-4">
              <input id="phone" name="phone" class="form-control" placeholder="手机号" type="text">
            </div>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">　关闭　</button>
        <button type="button" class="btn btn-success" data-dismiss="modal">　搜索　</button>
      </div>
    </div>
  </div>
</div>
</body>

</html>
